import request from '@/utils/axios'

export type MailLogType = {
  id: number
  userId: number
  userType: number
  toMail: string
  accountId: number
  fromMail: string
  templateId: number
  templateCode: string
  templateNickname: string
  templateTitle: string
  templateContent: string
  templateParams: string
  sendStatus: number
  sendTime: Date
  sendMessageId: string
  sendException: string
  create_time?: Date
}

export interface MailLogPageReqType extends PageParam {
  userId?: number
  userType?: number
  toMail?: string
  sendStatus?: number
  accountId?: number
  templateId?: number
  sendTime?: string[]
}

/**
 * 消息中心 - 邮箱管理 - 邮件日志接口
 */
export const MailLogApi = {
  // 查询详情
  detail: (id: number) => {
    return request.get({ url: '/system/mail-log/detail?id=' + id, is_mock: true })
  },
  // 查询分页列表
  page: (params: MailLogPageReqType) => {
    return request.get({ url: '/system/mail-log/page', params, is_mock: true })
  }
}
